<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>定位和居中问题</title>
    <style>
		* {
			margin: 0;
			padding: 0;
		}
		.main {
			width: 400px;
			height: 200px;
			background-color: #ccc;
			margin: 0 auto;
			position: absolute;
			top: 50%;
			left: 50%;
			margin-top: -100px;
			transform: translate(-50%);
			overflow: hidden;
		}
		.left,
		.right {
			position: absolute;
			width: 100px;
			height: 100px;
			border-radius: 50%;
			background-color: #fc0;
		}
		.left {
			top: -50px;
			left: -50px;
		}
		.right {
			right: -50px;
			bottom: -50px;
		}
    </style>
</head>
<body>
    <div class="main">
        <div class="left"></div>
        <div class="right"></div>
    </div>
</body>
</html>